<template>
	<!-- <el-dropdown trigger="click" class="international" @command="handleSetLanguage">
    <div>
      <svg-icon class-name="international-icon" icon-class="language" />
    </div>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item
        v-for="(item, key) in langList"
        :key="key"
        :disabled="language === item.abbr"
        :command="item.abbr"
      >
        {{ item.lang }}
      </el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown> -->
	<el-select :value="language" @change="handleSetLanguage">
		<el-option
			v-for="(item, key) in langList"
			:key="key"
			:disabled="language === item.langCode"
			:label="item.langName"
			:value="item.langCode"
		></el-option>
	</el-select>
</template>

<script>
export default {
	computed: {
		language() {
			return this.$store.getters.language
		},
		langList() {
			return this.$store.getters.langList
		}
	},
	methods: {
		handleSetLanguage(lang) {
			this.$i18n.locale = lang
			this.$store.dispatch('app/setLanguage', lang)
			window.location.reload()
		}
	}
}
</script>
